﻿@page "/dashboard/index"
@inherits AdminCompontentBase

<MRow>
    <MCol Md=8 Sm=12>
        <MRow>
            <MCol Md=9 Sm=12>
                <MCard Height=200>
                    <MCardText>
                        @if (_pageviewDayStatistics != null)
                        {
                            <MRow>
                                <MSpacer></MSpacer>
                                <MCol>@T("Page Views (PV)")</MCol>
                                <MCol>@T("Visitors (UV)")</MCol>
                                <MCol>@T("Number of IPs")</MCol>
                            </MRow>
                            @if (TodayStatistics != null)
                            {
                                <MRow>
                                    <MCol>@T("ToDay")</MCol>
                                    <MCol>@TodayStatistics.PV</MCol>
                                    <MCol>@TodayStatistics.UV</MCol>
                                    <MCol>@TodayStatistics.IPCount</MCol>
                                </MRow>
                            }
                            @if (YesterdayStatistics != null)
                            {
                                <MRow>
                                    <MCol>@T("Yesterday")</MCol>
                                    <MCol>@YesterdayStatistics.PV</MCol>
                                    <MCol>@YesterdayStatistics.UV</MCol>
                                    <MCol>@YesterdayStatistics.IPCount</MCol>
                                </MRow>
                            }
                        }
                    </MCardText>
                </MCard>
            </MCol>
            <MCol Md=3 Sm=12>
                <MCard Height=200>
                    <MCardText>
                        <MRow>
                            <MCol>
                                @T("Online/Offline users")
                            </MCol>
                        </MRow>
                        <MRow>
                            <MCol>
                                <MECharts Height=100 Width="@("100%")" Class="mt-1" Option=_onlineChart></MECharts>
                            </MCol>
                        </MRow>
                    </MCardText>
                </MCard>
            </MCol>
        </MRow>
        <MRow>
            <MCol>
                <MCard>
                    <MCardText>
                        <div style="position: absolute;margin-left: 70px;display: inline-block;z-index:2;">
                            <MButtonGroup Value="_current" ValueChanged="HandleOnChangeAsync" Color="primary" Mandatory>
                                <MButton Value="@("PV")" Small>
                                    @T("Page Views (PV)")
                                </MButton>
                                <MButton Value="@("UV")" Small>
                                    @T("Visitors (UV)")
                                </MButton>
                            </MButtonGroup>
                        </div>
                        <div class="d-flex align-center justify-center">
                            <MECharts Option="_option" Height="560" Width="@("100%")">
                            </MECharts>
                        </div>
                    </MCardText>
                </MCard>
            </MCol>
        </MRow>
    </MCol>
    <MCol Md=4 Sm=12>
        <MCard Class="max-height">
            <MCardText>
                @if (_operationLogs != null)
                {
                    <MDataTable Headers="_headers"
                            Items="_operationLogs"
                            Class="table-border-none pt-2"
                            HideDefaultFooter
                            ItemsPerPage="20"></MDataTable>
                }
            </MCardText>
        </MCard>
    </MCol>
</MRow>


